CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/config/[...page].tsx
Views: 923
1
/*
2
* This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Layout } from "antd";
7
import { join } from "path";
8
import ConfigLayout from "components/account/config/layout";
9
import Footer from "components/landing/footer";
10
import Head from "components/landing/head";
11
import Header from "components/landing/header";
12
import { Paragraph } from "components/misc";
13
import A from "components/misc/A";
14
import basePath from "lib/base-path";
15
import { Customize } from "lib/customize";
16
import withCustomize from "lib/with-customize";
17
18
export default function Preferences({ customize, page }) {
19
function noteAboutConfig() {
20
return (
21
<Paragraph
22
type="secondary"
23
style={{
24
padding: "15px",
25
margin: 0,
26
textAlign: "center",
27
borderTop: `1px solid lightgray`,
28
}}
29
>
30
This is the account configuration page.{" "}
31
<A href={join(basePath, "settings")} external>
32
You can also adjust preferences in the main app...
33
</A>
34
</Paragraph>
35
);
36
}
37
38
return (
39
<Customize value={customize}>
40
<Head title="Configuration" />
41
<Layout>
42
<Header page={"account"} />
43
<div style={{ margin: "30px", fontSize: "15pt" }}>
44
<A href="/settings/account">
45
This page is deprecated. Visit the settings pages instead...
46
</A>
47
</div>
48
<ConfigLayout page={page} />
49
{noteAboutConfig()}
50
<Footer />
51
</Layout>
52
</Customize>
53
);
54
}
55
56
export async function getServerSideProps(context) {
57
const { params, res } = context;
58
const { page = [] } = params;
59
60
const [_, sub] = page;
61
if (sub == null) {
62
return res.redirect(307, "./search/input");
63
}
64
65
return await withCustomize({ context, props: { page } });
66
}
67
68